import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import { BaseRouter } from 'next/dist/shared/lib/router/router';

type RouterReducerState = {
  router: Partial<BaseRouter> | null;
};

const initialState: RouterReducerState = {
  router: null,
};
const routerSlice = createSlice({
  name: 'router',
  initialState,
  reducers: {
    setRouter(state, action: PayloadAction<Partial<BaseRouter>>) {
      state.router = action.payload;
    },
  },
});
export const { setRouter } = routerSlice.actions;
export const routerReducer = routerSlice.reducer;
